package com.aloda.controller;

import com.aloda.pojo.dto.RecordPageDTO;
import com.aloda.pojo.entity.Record;
import com.aloda.result.PageResult;
import com.aloda.result.Result;
import com.aloda.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 借阅记录controller
 *
 * @author aloda
 */
@RestController
@RequestMapping("/record")
public class RecordController {

    @Autowired
    private RecordService recordService;

    /**
     * 分页查询借阅记录
     * @param recordPageDTO
     * @return
     */
    @PostMapping("/page")
    public Result<PageResult<Record>> getRecordPage(@RequestBody RecordPageDTO recordPageDTO) {
        PageResult<Record> result = recordService.getRecordPage(recordPageDTO);
        return Result.success(result);
    }
}
